﻿using Minecraft.CacheRedis;
using Minecraft.Config;
using Minecraft.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Minecraft.BLL.mysql
{
	public class TreasureboxBLL : BaseBLL
	{
		//private static RedisCacheHelper redisCacheHelper = new RedisCacheHelper();
		//private static RedisKey redisKeyEnum = RedisKey.Treasurebox;
		//public static List<TreasureboxModel> GetList(int playerId, out bool fromCache)
		//{
		//	fromCache = false;
		//	string redisKey = RedisKeyHelper.GetRedisKeyName(redisKeyEnum, playerId.ToString());
		//	var cacheList = redisCacheHelper.StringGet<List<TreasureboxModel>>(redisKey);
		//	if (cacheList != null)
		//	{
		//		fromCache = true;
		//		return cacheList;
		//	}
		//	else
		//	{
		//		var model = new TreasureboxModel();
		//		var list = GetList(model, new KeyValue<string, int> { key = nameof(model.PlayerId), value = playerId });
		//		redisCacheHelper.StringSet(redisKey, list, CommonConfig.DefRedisExpiry);
		//		return list;
		//	}
		//}
		//public static bool BatchUpdate(List<TreasureboxModel> list, int playerId, bool isCacheAfterDbOpt)
		//{
		//	string redisKey = RedisKeyHelper.GetRedisKeyName(redisKeyEnum, playerId.ToString());
		//	redisCacheHelper.StringSet(redisKey, list, CommonConfig.DefRedisExpiry);
		//	if (isCacheAfterDbOpt)
		//	{
		//		var model = new TreasureboxModel();
		//		return BatchUpdate(list, new KeyValue<string, int> { key = nameof(model.PlayerId), value = playerId });
		//	}
		//	return true;
		//}
	}
}
